"""POI (Point of Interest) model."""
from app import db
from app.models.base import BaseModel


class POI(BaseModel):
    """POI model representing points of interest."""
    
    __tablename__ = 'pois'
    
    name = db.Column(db.String(256), nullable=False)
    latitude = db.Column(db.Float, nullable=False)
    longitude = db.Column(db.Float, nullable=False)
    category = db.Column(db.String(64))
    description = db.Column(db.Text)
    photos = db.Column(db.JSON, default=list)
    rating = db.Column(db.Float)
    tags = db.Column(db.JSON, default=list)
    
    # External ID from map service
    external_id = db.Column(db.String(128), index=True)
    
    def to_dict(self):
        """Convert POI to dictionary."""
        return {
            'id': self.id,
            'name': self.name,
            'location': {
                'latitude': self.latitude,
                'longitude': self.longitude
            },
            'category': self.category,
            'description': self.description,
            'photos': self.photos,
            'rating': self.rating,
            'tags': self.tags
        }
